package com.hqyj.service.impl;

import com.hqyj.dao.UserInfoMapper;
import com.hqyj.pojo.UserInfo;
import com.hqyj.service.UserInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;

@Service
public class UserInfoImpl implements UserInfoService {


  @Autowired
  private UserInfoMapper userInfoMapper;


  @Override
  public HashMap<String, Object> list(String userName,String userPwd) {
    HashMap<String, Object> map = new HashMap<>();
    UserInfo userInfo = userInfoMapper.selectLogin(userName, userPwd);
    if(userInfo!=null){
      map.put("info","登录成功");
      map.put("user",userInfo);
    }else {
      map.put("info","登录失败");
    }
    return map;
  }

  @Override
  public HashMap<String, Object> selectPwd(Integer userId) {
    HashMap<String,Object> map =new HashMap<>();
    UserInfo userInfo = userInfoMapper.selectPwdById(userId);
    if(userInfo!=null){
      map.put("info","成功");
    }else {
      map.put("info","失败");
    }
    return map;
  }
}
